package io.gitee.chearnee.fw.datasecurity.core.enums;

import lombok.AccessLevel;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.Objects;

/**
 * Aes算法枚举
 *
 * @author kamjin1996
 */
@Getter
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
public enum AesEnum {

    /**
     * 标准与密钥长度、轮数
     */
    AES128("AES-128", 128, 16, 10),

    AES192("AES-192", 192, 24, 12),

    AES256("AES-256", 256, 32, 14);

    private final String standard;

    private final int standSupport;

    private final int secretKeyLength;

    private final int round;

    public static AesEnum byName(String aesName) {
        AesEnum[] values = AesEnum.values();
        for (AesEnum aes : values) {
            if (Objects.equals(aesName, aes.name())) {
                return aes;
            }
        }
        return null;
    }
}
